Skip to content

Conversation

@msukkari
Copy link
Contributor

Fix 'Error loading tree preview' for paths containing ... by refining the directory traversal check.

The previous check path.includes('..') was overly broad, preventing legitimate paths like [...path] (Next.js catch-all routes) from being viewed. The updated logic now splits the path into segments and only flags a path as invalid if any segment starts with .., effectively preventing directory traversal (../) while allowing .. within a filename.


Linear Issue: SOU-73

Open in Cursor Open in Web

The previous check blocked any path containing '..' anywhere, which caused
false positives for legitimate paths like '[...path]' (Next.js catch-all routes).

The fix splits the path by '/' and only blocks if a segment starts with '..',
which correctly identifies directory traversal attempts while allowing
legitimate filenames that contain '..' within them.

Co-authored-by: michael <[email protected]>
@cursor
Copy link

cursor bot commented Jan 15, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants